/*
Package v1
@Time : 2022/12/21 15:42
@Author : 董胜烨
@File : admin
@Software: GoLand
@note:
*/
package v1

import (
	"employee/service"
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
)

func AdminLogin(c *gin.Context) {
	aJson := &service.Admin{}
	err := c.BindJSON(aJson)
	if err != nil {
		panic(err)
		return
	}
	checkOk := aJson.Check()
	fmt.Println(aJson.Name)
	if checkOk {
		c.JSON(http.StatusOK, gin.H{
			"code": 0,
			"msg":  "登录成功",
			"data": aJson.Name,
		})
	} else {
		c.JSON(200, gin.H{
			"code": 1,
			"msg":  "登陆失败",
		})
	}
}
